<template>
    <div class="login">
        <div class="logo">
            <img src="https://msmk2019.oss-cn-shanghai.aliyuncs.com/uploads/image/2019pILfAg7Avr1567732916.png" alt="">
        </div>
        <div class="form">
            <van-field
                v-model="phone"
                center
                type="tel"
                placeholder="请输入手机号"
                >

            </van-field>
            <van-field v-model="password" type="password" placeholder="请输入密码" />
            <div class="findPassword">找回密码</div>
            <div class="register" @click="toRegister">注册/验证码登录</div>
            <button class="submit" @click="submit">登录</button>
        </div>
    </div>
</template>

<script>
import {login} from '../untils/netWork';
    export default {
        data:()=>({
            phone:"18530549398",
            password:"YeYu903908"
        }),
        methods:{
            submit(){
                var data={
                    type:1,
                    mobile: this.phone,
                    password: this.password
                }
                login(data).then(res=>{
                    console.log(res)
                    this.$router.push("/mine");
                    window.localStorage.setItem("username",res.data.id);
                    window.localStorage.setItem("token",res.data.remember_token);
                })
            },
            toRegister(){
                this.$router.push("/register")
            }
        }
    }
</script>

<style lang="scss" scoped>
@import "@/assets/common.scss";
.login{
    width: 100%;
    .logo{
        width: 65%;
        margin: 50px auto;
        img{
            width: 100%;
        }
    }
    .van-cell{
        padding-top: 15px;
        padding-bottom: 15px;
    }
    .findPassword,
    .register{
        height: 30px;
        line-height: 30px;
        color: rgb(200,200,200);
    }
    .findPassword{
        float: left;
        padding-left: 15px;
    }
    .register{
        float: right;
    }
    .form{
        width: 80%;
        margin: 20px auto;
        .submit{
            width: 100%;
            height: 45px;
            margin-top: 50px;
            border: 0;
            outline: none;
            background: linear-gradient(to right, rgb(255,139,64) , rgb(252,85,0));
            border-radius: 30px;
            font-size: 18px;
            color: white;
        }
    }

}
</style>